class MatchesController < ApplicationController
  layout "main_layout"

  def index
    @matches = Match.find(:all)
  end

  def new
    @match = Match.new
    @maps = Map.find(:all)
    render :template => 'matches/new'
  end
  
  def add_team
    map = Map.find_by_id(params[:map])
    render :partial => "matches/add_teams", :locals => { :map => map }
  end

  def create
    @match = Match.new(params[:match])

    if @match.save
      redirect_to home_path
    else
      render :template => 'matches/new'
    end
  end
  
end
